package com.phuc.game.tankshooter;

import com.phuc.game.tankshooter.common.Utility;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;

public class PauseActivity extends Activity {

	/**
	 * Pop02.
	 */
	private AlertDialog.Builder confirmExit;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.pause);
		
		// Confirm exit
    	this.confirmExit = new AlertDialog.Builder(this);
    	this.confirmExit.setMessage(R.string.confirm_surender);
    	this.confirmExit.setCancelable(false);
    	this.confirmExit.setNegativeButton(R.string.yes, new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int id) {
				dialog.cancel();
				PauseActivity.this.setResult(10000);
				PauseActivity.this.finish();
			}
		});
    	this.confirmExit.setPositiveButton(R.string.no, new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int id) {
				dialog.cancel();
			}
		});
	}
	
	public void onResumeClick(View v) {
		this.finish();
	}
	
	public void onSurrenderClick(View v) {
		confirmExit.show();
	}
	
	@Override
	protected void onDestroy() {
		super.onDestroy();
		Utility.unbindDrawable(findViewById(R.id.root));
		System.gc();
	}
}
